package com.sudo.boot.mapper.sys.entity;

import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.sudo.boot.mybatisflex.base.BaseEntity;
import lombok.Getter;
import lombok.Setter;

import java.util.Objects;

@Getter
@Setter
@Table("sys_local_job")
public class SysLocalJob extends BaseEntity {
    /**
     * 主键
     */
    @Id(keyType = KeyType.Auto)
    private Integer id;

    /**
     * 标题
     */
    private String jobTitle;

    private String beanName;

    private String methodName;

    private String methodParams;
    /**
      * Cron表达式
      */
    private String cronExpression;

    /**
     * 定时任务状态：STOP 表示暂停，RUN 表示运行
     * {@link com.sudo.boot.base.constant.enums.EnumStatus}
     */
    private String status;

    private String note;

    /**
     * 日志状态
     * {@link com.sudo.boot.base.constant.enums.EnumStatus}
     */
    private String logStatus;

    /**
     * 邮件状态
     * {@link com.sudo.boot.base.constant.enums.EnumStatus}
     */
    private String mailStatus;

    /**
     * 异常邮件地址
     */
    private String mailAddress;

    /**
     * 下批任务ID合集（逗号分隔）
     */
    private String nextJobIds;

    /**
     * 下批任务运行模式
     * {@link com.sudo.boot.common.constant.enums.RunModeType}
     */
    private String nextJobMode;

    /**
     * 下批任务异常受限
     * {@link com.sudo.boot.common.constant.enums.ExceptionLimit}
     */
    private String nextJobLimit;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        SysLocalJob sysLocalJob = (SysLocalJob) o;
        return Objects.equals(beanName, sysLocalJob.beanName) && Objects.equals(methodName, sysLocalJob.methodName) && Objects.equals(methodParams, sysLocalJob.methodParams) && Objects.equals(cronExpression, sysLocalJob.cronExpression);
    }

    @Override
    public int hashCode() {
        return Objects.hash(beanName, methodName, methodParams, cronExpression);
    }

}
